<template>
	<view class="page">
		<block v-if="showStatus">
			<top-detail @selectItmAppearance='selectItmAppearance' @selectItmStatus='selectItmStatus'></top-detail>
			<view class="title mg">
				工程师评价
			</view>
			<view class="evaluate">
				<view class="title  j-sb row">
					<text>工程师：</text>
					<text>张三</text>
				</view>
				<text>评价：</text>
				<view class="stars">
					<image :src="item" v-for="(item,index) in stars" :key='index' @tap="choiceStrt(index)"></image>
				</view>
			</view>
			<view class="btn btn_agree" @tap="submitReport">
				提交评价
			</view>
		</block>
		<block v-else>
			<view class="tickSuccess">
				<image src="../../static/icon/tick.png" mode=""></image>
				<text class="subtitel">提交成功</text>
			</view>
			<view class="btn btn_refuse" @tap="submitReport">
				返回工单中心
			</view>
		</block>
	</view>

</template>

<script>
	import topDetail from '@/components/top_detail.vue'
	export default {
		components: {
			topDetail
		},
		data() {
			return {
				showStatus: true,
				//星星评分  样式
				stars: [
					"/static/icon/stars.png",
					"/static/icon/stars.png",
					"/static/icon/stars.png",
					"/static/icon/stars.png",
					"/static/icon/stars.png"
				],
				empty: [
					"/static/icon/stars.png",
					"/static/icon/stars.png",
					"/static/icon/stars.png",
					"/static/icon/stars.png",
					"/static/icon/stars.png"
				],
				//星星评分  具体数量
				num: 0
			}
		},
		methods: {
			//星星评分
			choiceStrt(i) {
				this.stars = [...this.empty]
				this.num = i + 1
				for (let j = 0; j < this.num; j++) {
					this.stars.splice(j, 1, '/static/icon/starsed.png')
				}
			},
			//提交评价
			submitReport() {
				this.showStatus = !this.showStatus
			}
		}
	}
</script>

<style lang="scss" scoped>
	.btn_refuse{
		margin: 30rpx 0 50rpx;
		background: #FFFFFF;
		opacity: 0.59;
		color: #4252CD;
		border: 2rpx solid #4252CD;
	}
	.subtitel {
		font-size: 32rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #4252CD;
		line-height: 44rpx;
		margin-top: 60rpx;
	}

	.tickSuccess {
		padding-top: 354rpx;
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;

		image {
			width: 154rpx;
			height: 154rpx;
		}
	}

	.btn {
		margin: 78rpx 0;
		border-radius: 46rpx;
		height: 92rpx;
		line-height: 92rpx;
		text-align: center;
	}

	.btn_agree {
		font-size: 28rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		background: #4252CD;
		color: #FFFFFF;
	}

	.title {
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #7F8084;
		line-height: 40rpx;
	}

	.page {
		padding: 0 30rpx;
		box-sizing: border-box;
	}

	.stars {
		width: 320rpx;
		margin: 0 auto;
		position: absolute;
		top: 174rpx;
		transform: translate(50%, 0);
		display: grid;
		grid-column-gap: 30rpx;
		grid-auto-flow: column;

		image {
			width: 40rpx;
			height: 38rpx;
		}
	}

	.evaluate {
		position: relative;
		margin-top: 24rpx;
		height: 252rpx;
		background: #F9F9F9;
		border-radius: 20rpx;
		padding: 20rpx;
		box-sizing: border-box;

		text {
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #7F8084;
			line-height: 40rpx;
		}
	}
</style>
